The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Changes 019
META.yml 11
bin/cpanm 33165
lib/App/cpanminus.pm 27119
4 files changed (This is a version diff) 61304
@@ -1,5 +1,24 @@
 See http://github.com/miyagawa/cpanminus/ for the latest development.
 
+1.3001   Thu Mar  3 18:33:56 PST 2011
+   - Documentation overhaul
+   - Fixed a bug -L will install non-core modules again and again for each run
+
+1.3000   Wed Mar  2 14:39:44 PST 2011
+   - No changes since the last beta
+
+1.29_02  Tue Mar  1 16:06:20 PST 2011
+   - Improved the dependencies detection when -L is in use so the core modules that have been upgraded
+     inside can be correctly be detected, using Module::CoreList.
+   - Added a crazy hack to support Build.PL configure dependencies > 0.36 when -L is in effect
+
+1.29_01  Mon Feb 28 18:57:27 PST 2011
+   - Disable --uninstall-shadows by default for perl >= 5.12
+
+1.2001  Wed Feb 16 10:54:21 PST 2011
+   - This be official 1.2
+   - Skips tests during the bootstrap, making a much better first time experience
+
 1.19_02 Tue Jan 18 14:11:23 PST 2011
    - Module::Metadata now requires version.pm 0.87. This makes cpanm unable to boostrap when version.pm is
      older than that. For now, include the pure perl version/vpp.pm and version.pm in the fatlib and then
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               App-cpanminus
-version:            1.19_02
+version:            1.3001
 abstract:           Get, unpack, build and install modules from CPAN.
 author:  []
 license:            perl
@@ -18,7 +18,7 @@ my %fatpacked;
 
 $fatpacked{"App/cpanminus.pm"} = <<'APP_CPANMINUS';
   package App::cpanminus;
-  our $VERSION = "1.19_02";
+  our $VERSION = "1.3001";
   
   =head1 NAME
   
@@ -32,39 +32,58 @@ $fatpacked{"App/cpanminus.pm"} = <<'APP_CPANMINUS';
   
   =head1 DESCRIPTION
   
-  cpanminus is a script to get, unpack, build and install modules from CPAN.
+  cpanminus is a script to get, unpack, build and install modules from
+  CPAN and does nothing else.
   
-  Why? It's dependency free, requires zero configuration, and stands
-  alone. When running, it requires only 10MB of RAM.
+  It's dependency free (can bootstrap itself), requires zero
+  configuration, and stands alone. When running, it requires only 10MB
+  of RAM.
   
   =head1 INSTALLATION
   
+  There are several ways to install cpanminus to your system.
+  
+  =head2 Package management system
+  
   There are Debian packages, RPMs, FreeBSD ports, and packages for other
   operation systems available. If you want to use the package management system,
   search for cpanminus and use the appropriate command to install. This makes it
   easy to install C<cpanm> to your system without thinking about where to
   install, and later upgrade.
   
+  =head2 Installing to system perl
+  
   You can also use the latest cpanminus to install cpanminus itself:
   
       curl -L http://cpanmin.us | perl - --sudo App::cpanminus
   
   This will install C<cpanm> to your bin directory like
   C</usr/local/bin> (unless you configured C<INSTALL_BASE> with
-  L<local::lib>), so you might need the C<--sudo> option.
+  L<local::lib>), so you probably need the C<--sudo> option.
+  
+  =head2 Installing to local perl (perlbrew)
+  
+  If you have perl in your home directory, which is the case if you use
+  tools like L<perlbrew>, you don't need the C<--sudo> option, since
+  you're most likely to have a write permission to the perl's library
+  path. You can just do:
   
-  Later you can say C<cpanm --self-upgrade --sudo> to upgrade to the
-  latest version.
+      curl -L http://cpanmin.us | perl - App::cpanminus
   
-  Otherwise,
+  to install the C<cpanm> executable to the perl's bin path, like
+  C<~/perl5/perlbrew/bin/cpanm>.
+  
+  =head2 Downloaing the standalone executable
+  
+  You can also copy the standalone executable to whatever location you'd like.
   
       cd ~/bin
       curl -LO http://xrl.us/cpanm
       chmod +x cpanm
       # edit shebang if you don't have /usr/bin/env
   
-  just works, but be sure to grab the new version manually when you
-  upgrade (C<--self-upgrade> might not work).
+  This just works, but be sure to grab the new version manually when you
+  upgrade because C<--self-upgrade> might not work for this.
   
   =head1 DEPENDENCIES
   
@@ -101,11 +120,10 @@ $fatpacked{"App/cpanminus.pm"} = <<'APP_CPANMINUS';
   
   =head2 But why a new client?
   
-  First of all, I have no intention to dis CPAN or CPANPLUS
-  developers. Don't get me wrong. They're great tools I've 
-  used for I<literally> years (you know how many modules I have
-  on CPAN, right?). I really respect their efforts of maintaining the
-  most important tools in the CPAN toolchain ecosystem.
+  First of all, let me be clear that CPAN and CPANPLUS are great tools
+  I've used for I<literally> years (you know how many modules I have on
+  CPAN, right?). I really respect their efforts of maintaining the most
+  important tools in the CPAN toolchain ecosystem.
   
   However, for less experienced users (mostly from outside the Perl community),
   or even really experienced Perl developers who know how to shoot themselves in
@@ -118,24 +136,94 @@ $fatpacked{"App/cpanminus.pm"} = <<'APP_CPANMINUS';
   It queries the CPAN Meta DB site running on Google AppEngine at
   L<http://cpanmetadb.appspot.com/>. The site is updated every hour to reflect
   the latest changes from fast syncing mirrors. The script then also falls back
-  to the site L<http://search.cpan.org/>. I've been talking to and working with
-  with the QA/toolchain people for building a more reliable CPAN DB website.
+  to scrape the site L<http://search.cpan.org/>.
   
-  Fetched files are unpacked in C<~/.cpanm>.  You can configure this with
-  the C<PERL_CPANM_HOME> environment variable.
+  Fetched files are unpacked in C<~/.cpanm> and automatically cleaned up
+  periodically.  You can configure the location of this with the
+  C<PERL_CPANM_HOME> environment variable.
   
   =head2 Where does this install modules to? Do I need root access?
   
   It installs to wherever ExtUtils::MakeMaker and Module::Build are
-  configured to (via C<PERL_MM_OPT> and C<MODULEBUILDRC>). So if
-  you're using local::lib, then it installs to your local perl5
-  directory. Otherwise it installs to the siteperl directory.
+  configured to (via C<PERL_MM_OPT> and C<PERL_MB_OPT>). So if you're
+  using local::lib, then it installs to your local perl5
+  directory. Otherwise it installs to the site_perl directory that
+  belongs to your perl.
+  
+  cpanminus at a boot time checks whether you have configured
+  local::lib, or have the permission to install modules to the site_perl
+  directory.  If neither, it automatically sets up local::lib compatible
+  installation path in a C<perl5> directory under your home
+  directory. To avoid this, run the script as the root user, with
+  C<--sudo> option or with C<--local-lib> option.
+  
+  =head2 cpanminus can't install the module XYZ. Is it a bug?
   
-  cpanminus at a boot time checks whether you have configured local::lib, or have
-  the permission to install modules to the sitelib directory.  If neither, it
-  automatically sets up local::lib compatible installation path in a C<perl5>
-  directory under your home directory. To avoid this, run the script as the root
-  user, with C<--sudo> option or with C<--local-lib> option.
+  It is more likely a problem with the distribution itself. cpanminus
+  doesn't support or is known to have issues with distributions like as
+  follows:
+  
+  =over 4
+  
+  =item *
+  
+  Tests that require input from STDIN.
+  
+  =item *
+  
+  Tests that might fail when C<AUTOMATED_TESTING> is enabled.
+  
+  =item *
+  
+  Modules that have invalid numeric values as VERSION (such as C<1.1a>)
+  
+  =back
+  
+  These failures can be reported back to the author of the module so
+  that they can fix it accordingly, rather than me.
+  
+  =head2 Does cpanm support the feature XYZ of L<CPAN> and L<CPANPLUS>?
+  
+  Most likely not. Here are the things that cpanm doesn't do by
+  itself. And it's a feature - you got that from the name I<minus>,
+  right?
+  
+  If you need these features, use L<CPAN>, L<CPANPLUS> or the standalone
+  tools that are mentioned.
+  
+  =over 4
+  
+  =item *
+  
+  Bundle:: module dependencies
+  
+  =item *
+  
+  CPAN testers reporting
+  
+  =item *
+  
+  Building RPM packages from CPAN modules
+  
+  =item *
+  
+  Listing the outdated modules that needs upgrading. See L<cpan-outdated>
+  
+  =item *
+  
+  Uninstalling modules. See L<pm-uninstall>.
+  
+  =item *
+  
+  Showing the changes of the modules you're about to upgrade. See L<cpan-listchanges>
+  
+  =item *
+  
+  Patching CPAN modules with distroprefs.
+  
+  =back
+  
+  See L<cpanm> or C<cpanm -h> to see what cpanminus I<can> do :)
   
   =head1 COPYRIGHT
   
@@ -145,6 +233,8 @@ $fatpacked{"App/cpanminus.pm"} = <<'APP_CPANMINUS';
   
   =over 4
   
+  =item L<CPAN::DistnameInfo> Copyright 2003 Graham Barr
+  
   =item L<Parse::CPAN::Meta> Copyright 2006-2009 Adam Kennedy
   
   =item L<local::lib> Copyright 2007-2009 Matt S Trout
@@ -153,6 +243,8 @@ $fatpacked{"App/cpanminus.pm"} = <<'APP_CPANMINUS';
   
   =item L<Module::Metadata> Copyright 2001-2006 Ken Williams. 2010 Matt S Trout
   
+  =item L<version> Copyright 2004-2010 John Peacock
+  
   =back
   
   =head1 LICENSE
@@ -220,8 +312,7 @@ $fatpacked{"App/cpanminus/script.pm"} = <<'APP_CPANMINUS_SCRIPT';
   use constant WIN32 => $^O eq 'MSWin32';
   use constant SUNOS => $^O eq 'solaris';
   
-  our $VERSION = "1.19_02";
-  $VERSION = eval $VERSION;
+  our $VERSION = "1.3001";
   
   my $quote = WIN32 ? q/"/ : q/'/;
   
@@ -253,7 +344,7 @@ $fatpacked{"App/cpanminus/script.pm"} = <<'APP_CPANMINUS_SCRIPT';
           try_lwp => 1,
           try_wget => 1,
           try_curl => 1,
-          uninstall_shadows => 1,
+          uninstall_shadows => ($] < 5.012),
           skip_installed => 1,
           auto_cleanup => 7, # days
           @_,
@@ -315,7 +406,7 @@ $fatpacked{"App/cpanminus/script.pm"} = <<'APP_CPANMINUS_SCRIPT';
   
       $self->bootstrap_local_lib;
       if (@{$self->{bootstrap_deps} || []}) {
-          local $self->{force} = 1; # to force install EUMM
+          local $self->{notest} = 1; # test failure in bootstrap should be tolerated
           $self->install_deps(Cwd::cwd, 0, @{$self->{bootstrap_deps}});
       }
   }
@@ -1155,6 +1246,14 @@ $fatpacked{"App/cpanminus/script.pm"} = <<'APP_CPANMINUS_SCRIPT';
           or return 0, undef;
   
       my $version = $meta->version;
+  
+      # When -L is in use, the version loaded from 'perl' library path
+      # might be newer than the version that is shipped with the current perl
+      if ($self->{self_contained} && $self->loaded_from_perl_lib($meta)) {
+          require Module::CoreList;
+          $version = $Module::CoreList::version{$]}{$mod};
+      }
+  
       $self->{local_versions}{$mod} = $version;
   
       if ($self->is_deprecated($meta)){
@@ -1175,6 +1274,11 @@ $fatpacked{"App/cpanminus/script.pm"} = <<'APP_CPANMINUS_SCRIPT';
       };
   
       return unless $deprecated;
+      return $self->loaded_from_perl_lib($meta);
+  }
+  
+  sub loaded_from_perl_lib {
+      my($self, $meta) = @_;
   
       require Config;
       for my $dir (qw(archlibexp privlibexp)) {
@@ -1244,6 +1348,25 @@ $fatpacked{"App/cpanminus/script.pm"} = <<'APP_CPANMINUS_SCRIPT';
       return 1;
   }
   
+  sub _patch_module_build_config_deps {
+      my($self, $config_deps) = @_;
+  
+      # Crazy hack to auto-add Module::Build dependencies into
+      # configure_requires if Module::Build is there, since there's a
+      # possibility where Module::Build is in 'perl' library path while
+      # the dependencies are in 'site' and can't be loaded when -L
+      # (--local-lib-contained) is in effect.
+  
+      my %config_deps = (@{$config_deps});
+      if ($config_deps{"Module::Build"}) {
+          push @{$config_deps}, (
+              'Perl::OSType' => 1,
+              'Module::Metadata' => 1.000002,
+              'version' => 0.87,
+          );
+      }
+  }
+  
   sub build_stuff {
       my($self, $stuff, $dist, $depth) = @_;
   
@@ -1257,6 +1380,9 @@ $fatpacked{"App/cpanminus/script.pm"} = <<'APP_CPANMINUS_SCRIPT';
   
       my $target = $dist->{meta}{name} ? "$dist->{meta}{name}-$dist->{meta}{version}" : $dist->{dir};
   
+      $self->_patch_module_build_config_deps(\@config_deps)
+          if $self->{self_contained};
+  
       $self->install_deps_bailout($target, $dist->{dir}, $depth, @config_deps)
           or return;
   
@@ -6489,8 +6615,14 @@ specify custom installation path, you SHOULD disable this option so
 you won't accidentally uninstall dual-life modules from the core
 include path.
 
-Defaults to true, and you can disable that with
-C<--no-uninst-shadows>.
+Defaults to true if your perl version is smaller than 5.12, and you
+can disable that with C<--no-uninst-shadows>.
+
+B<NOTE>: Since version 1.3000 this flag is turned off by default for
+perl newer than 5.12, since with 5.12 @INC contains site_perl directory
+I<before> the perl core library path, and uninstalling shadows is not
+necessary anymore and does more harm by deleting files from the core
+library path.
 
 =item --auto-cleanup
 
@@ -1,5 +1,5 @@
 package App::cpanminus;
-our $VERSION = "1.19_02";
+our $VERSION = "1.3001";
 
 =head1 NAME
 
@@ -13,39 +13,58 @@ Run C<cpanm -h> for more options.
 
 =head1 DESCRIPTION
 
-cpanminus is a script to get, unpack, build and install modules from CPAN.
+cpanminus is a script to get, unpack, build and install modules from
+CPAN and does nothing else.
 
-Why? It's dependency free, requires zero configuration, and stands
-alone. When running, it requires only 10MB of RAM.
+It's dependency free (can bootstrap itself), requires zero
+configuration, and stands alone. When running, it requires only 10MB
+of RAM.
 
 =head1 INSTALLATION
 
+There are several ways to install cpanminus to your system.
+
+=head2 Package management system
+
 There are Debian packages, RPMs, FreeBSD ports, and packages for other
 operation systems available. If you want to use the package management system,
 search for cpanminus and use the appropriate command to install. This makes it
 easy to install C<cpanm> to your system without thinking about where to
 install, and later upgrade.
 
+=head2 Installing to system perl
+
 You can also use the latest cpanminus to install cpanminus itself:
 
     curl -L http://cpanmin.us | perl - --sudo App::cpanminus
 
 This will install C<cpanm> to your bin directory like
 C</usr/local/bin> (unless you configured C<INSTALL_BASE> with
-L<local::lib>), so you might need the C<--sudo> option.
+L<local::lib>), so you probably need the C<--sudo> option.
+
+=head2 Installing to local perl (perlbrew)
+
+If you have perl in your home directory, which is the case if you use
+tools like L<perlbrew>, you don't need the C<--sudo> option, since
+you're most likely to have a write permission to the perl's library
+path. You can just do:
+
+    curl -L http://cpanmin.us | perl - App::cpanminus
+
+to install the C<cpanm> executable to the perl's bin path, like
+C<~/perl5/perlbrew/bin/cpanm>.
 
-Later you can say C<cpanm --self-upgrade --sudo> to upgrade to the
-latest version.
+=head2 Downloaing the standalone executable
 
-Otherwise,
+You can also copy the standalone executable to whatever location you'd like.
 
     cd ~/bin
     curl -LO http://xrl.us/cpanm
     chmod +x cpanm
     # edit shebang if you don't have /usr/bin/env
 
-just works, but be sure to grab the new version manually when you
-upgrade (C<--self-upgrade> might not work).
+This just works, but be sure to grab the new version manually when you
+upgrade because C<--self-upgrade> might not work for this.
 
 =head1 DEPENDENCIES
 
@@ -82,11 +101,10 @@ think so.
 
 =head2 But why a new client?
 
-First of all, I have no intention to dis CPAN or CPANPLUS
-developers. Don't get me wrong. They're great tools I've 
-used for I<literally> years (you know how many modules I have
-on CPAN, right?). I really respect their efforts of maintaining the
-most important tools in the CPAN toolchain ecosystem.
+First of all, let me be clear that CPAN and CPANPLUS are great tools
+I've used for I<literally> years (you know how many modules I have on
+CPAN, right?). I really respect their efforts of maintaining the most
+important tools in the CPAN toolchain ecosystem.
 
 However, for less experienced users (mostly from outside the Perl community),
 or even really experienced Perl developers who know how to shoot themselves in
@@ -99,24 +117,94 @@ writing code.
 It queries the CPAN Meta DB site running on Google AppEngine at
 L<http://cpanmetadb.appspot.com/>. The site is updated every hour to reflect
 the latest changes from fast syncing mirrors. The script then also falls back
-to the site L<http://search.cpan.org/>. I've been talking to and working with
-with the QA/toolchain people for building a more reliable CPAN DB website.
+to scrape the site L<http://search.cpan.org/>.
 
-Fetched files are unpacked in C<~/.cpanm>.  You can configure this with
-the C<PERL_CPANM_HOME> environment variable.
+Fetched files are unpacked in C<~/.cpanm> and automatically cleaned up
+periodically.  You can configure the location of this with the
+C<PERL_CPANM_HOME> environment variable.
 
 =head2 Where does this install modules to? Do I need root access?
 
 It installs to wherever ExtUtils::MakeMaker and Module::Build are
-configured to (via C<PERL_MM_OPT> and C<MODULEBUILDRC>). So if
-you're using local::lib, then it installs to your local perl5
-directory. Otherwise it installs to the siteperl directory.
+configured to (via C<PERL_MM_OPT> and C<PERL_MB_OPT>). So if you're
+using local::lib, then it installs to your local perl5
+directory. Otherwise it installs to the site_perl directory that
+belongs to your perl.
+
+cpanminus at a boot time checks whether you have configured
+local::lib, or have the permission to install modules to the site_perl
+directory.  If neither, it automatically sets up local::lib compatible
+installation path in a C<perl5> directory under your home
+directory. To avoid this, run the script as the root user, with
+C<--sudo> option or with C<--local-lib> option.
+
+=head2 cpanminus can't install the module XYZ. Is it a bug?
+
+It is more likely a problem with the distribution itself. cpanminus
+doesn't support or is known to have issues with distributions like as
+follows:
+
+=over 4
+
+=item *
+
+Tests that require input from STDIN.
+
+=item *
+
+Tests that might fail when C<AUTOMATED_TESTING> is enabled.
+
+=item *
+
+Modules that have invalid numeric values as VERSION (such as C<1.1a>)
+
+=back
+
+These failures can be reported back to the author of the module so
+that they can fix it accordingly, rather than me.
+
+=head2 Does cpanm support the feature XYZ of L<CPAN> and L<CPANPLUS>?
+
+Most likely not. Here are the things that cpanm doesn't do by
+itself. And it's a feature - you got that from the name I<minus>,
+right?
+
+If you need these features, use L<CPAN>, L<CPANPLUS> or the standalone
+tools that are mentioned.
 
-cpanminus at a boot time checks whether you have configured local::lib, or have
-the permission to install modules to the sitelib directory.  If neither, it
-automatically sets up local::lib compatible installation path in a C<perl5>
-directory under your home directory. To avoid this, run the script as the root
-user, with C<--sudo> option or with C<--local-lib> option.
+=over 4
+
+=item *
+
+Bundle:: module dependencies
+
+=item *
+
+CPAN testers reporting
+
+=item *
+
+Building RPM packages from CPAN modules
+
+=item *
+
+Listing the outdated modules that needs upgrading. See L<cpan-outdated>
+
+=item *
+
+Uninstalling modules. See L<pm-uninstall>.
+
+=item *
+
+Showing the changes of the modules you're about to upgrade. See L<cpan-listchanges>
+
+=item *
+
+Patching CPAN modules with distroprefs.
+
+=back
+
+See L<cpanm> or C<cpanm -h> to see what cpanminus I<can> do :)
 
 =head1 COPYRIGHT
 
@@ -126,6 +214,8 @@ The standalone executable contains the following modules embedded.
 
 =over 4
 
+=item L<CPAN::DistnameInfo> Copyright 2003 Graham Barr
+
 =item L<Parse::CPAN::Meta> Copyright 2006-2009 Adam Kennedy
 
 =item L<local::lib> Copyright 2007-2009 Matt S Trout
@@ -134,6 +224,8 @@ The standalone executable contains the following modules embedded.
 
 =item L<Module::Metadata> Copyright 2001-2006 Ken Williams. 2010 Matt S Trout
 
+=item L<version> Copyright 2004-2010 John Peacock
+
 =back
 
 =head1 LICENSE